<?php
    require_once("./classes/conexao.php");
    require_once("./classes/sessao.php");
    require_once("./classes/interfaces.php");

    session_start();

    if (!isset($_SESSION['ANAWEB']) || $_SESSION['ANAWEB']->RetornaIdioma() == "PT_BR")
    {
        $msg = new Traducao("/home/projetos/anaweb/anaweb-new/linguas/linguas.xml", "pt-br");
    }
    else
    {
        $msg = new Traducao("/home/projetos/anaweb/anaweb-new/linguas/linguas.xml", "en-us");
    }

    $pagina = new Interfaces();
    $scripts = array("tree.js","tree_tpl.js");
    $pagina->Header("ANAWEB", $scripts);
    $pagina->Body();

?>
    <h1><?php echo $msg->get('Upload_metodos') ?></h1>
            <div id="upload">
            <form name="formupload" enctype="multipart/form-data" action="upload.php" method="post">
            <script language="javascript" type="text/javascript">
                function mudatopico( topico )
                {
                    tamanho = document.formupload.subtopico.length;
                    for (i=tamanho-1; i >= 0; i--)
                    {
                        document.formupload.subtopico[i] = null;
                    }
                    selecionado = topico.selectedIndex;
                    switch(selecionado)
                    {
                        case 0:
                            document.formupload.subtopico[0] = new Option("<?php echo $msg->get('Menu_Sistema_PF') ?>","0");
                            document.formupload.subtopico[1] = new Option("<?php echo $msg->get('Menu_Soma') ?>","1");
                            document.formupload.subtopico[2] = new Option("<?php echo $msg->get('Menu_Subtracao') ?>","2");
                            document.formupload.subtopico[3] = new Option("<?php echo $msg->get('Menu_Multiplicacao') ?>","3");
                            document.formupload.subtopico[4] = new Option("<?php echo $msg->get('Menu_Divisao') ?>","4");
                            break;
                        case 1:
                            document.formupload.subtopico[0] = new Option("<?php echo $msg->get('Menu_Soma') ?>","0");
                            document.formupload.subtopico[1] = new Option("<?php echo $msg->get('Menu_Multiplicacao') ?>","1");
                            document.formupload.subtopico[2] = new Option("<?php echo $msg->get('Menu_Transposta') ?>","2");
                            document.formupload.subtopico[3] = new Option("<?php echo $msg->get('Menu_Determinante') ?>","3");
                            document.formupload.subtopico[4] = new Option("<?php echo $msg->get('Menu_Inversa') ?>","4");
                            document.formupload.subtopico[5] = new Option("<?php echo $msg->get('Menu_Decomposicao') ?>","5");
                            document.formupload.subtopico[6] = new Option("<?php echo $msg->get('Menu_Matrizes_Definidas_Positivas') ?>","6");
                            break;
                        case 2:
                            document.formupload.subtopico[0] = new Option("topico1","0");
                            document.formupload.subtopico[1] = new Option("topico2","1");
                            document.formupload.subtopico[2] = new Option("topico3","2");
                            document.formupload.subtopico[3] = new Option("topico4","3");
                            document.formupload.subtopico[4] = new Option("topico5","4");
                            document.formupload.subtopico[5] = new Option("topico6","5");
                            break;
                        case 3:
                            document.formupload.subtopico[0] = new Option("topico1","0");
                            document.formupload.subtopico[1] = new Option("topico2","1");
                            document.formupload.subtopico[2] = new Option("topico3","2");
                            break;
                        case 4:
                            document.formupload.subtopico[0] = new Option("topico1","0");
                            document.formupload.subtopico[1] = new Option("topico2","1");
                            break;
                        case 5:
                            document.formupload.subtopico[0] = new Option("topico1","0");
                            document.formupload.subtopico[1] = new Option("topico2","1");
                            document.formupload.subtopico[2] = new Option("topico3","2");
                            break;
                        case 6:
                            document.formupload.subtopico[0] = new Option("topico1","0");
                            break;
                        case 7:
                            document.formupload.subtopico[0] = new Option("topico1","0");
                            break;
                        case 8:
                            document.formupload.subtopico[0] = new Option("topico1","0");
                            document.formupload.subtopico[1] = new Option("topico2","1");
                            document.formupload.subtopico[2] = new Option("topico3","2");
                            document.formupload.subtopico[3] = new Option("topico4","3");
                            break;
                        default:
                            document.formupload.subtopico[0] = new Option("-","-");
                    }
                }
            </script>
            <p>
                    <label for="descricao"><?php echo $msg->get('Descricao') ?>:</label>
                    <input class="inputtexto" type="text" id="descricao" name="descricao">
            </p>
            <p>
                    <label for="topico"><?php echo $msg->get('Topico') ?>:</label>
                    <select name="topico" id="topico" onchange="mudatopico(document.formupload.topico)">
                        <option value="ptoflut"><?php echo $msg->get('Ptoflut') ?></option>
                        <option value="matriz"><?php echo $msg->get('Matriz') ?></option>
                        <option value="sistemas"><?php echo $msg->get('Sistemas') ?></option>
                        <option value="interpolacao"><?php echo $msg->get('Interpolacao') ?></option>
                        <option value="ajdados"><?php echo $msg->get('Ajuste_Dados') ?></option>
                        <option value="reseqnl"><?php echo $msg->get('Reseqnl') ?></option>
                        <option value="siseqnl"><?php echo $msg->get('Siseqnl') ?></option>
                        <option value="derivada"><?php echo $msg->get('Derivada') ?></option>
                        <option value="integral"><?php echo $msg->get('Integral') ?></option>
                        <option selected>-</option>
                    </select>
            </p>
            <p>
                    <label for="subtopico">Subtopico:</label>
                    <select name="subtopico" id="subtopico">
                        <option>-</option>
                    </select>
            </p>
            <p>
                    <label for="arquivo"><?php echo $msg->get('Arquivo') ?>:</label>
                    <input name="arquivo" id="arquivo" type="file">
            </p>
            <script type="text/javascript">mudatopico(0)</script>
            <p>
                    <input class="botao" type="submit" value="Enviar">
            </p>
            </form>
            </div>
<?php

    $pagina->Footer();
?>
